<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../admin/libs/tinymce/tinymce.min.js"></script>
  </head>
  <body>
    <textarea name="mytextarea" id="mytextarea"></textarea>
    <script>
      tinymce.init({
        selector: "#mytextarea",
        height: "350px",
        language: "zh_CN",
        directionality: "ltl",
        browser_spellcheck: true,
        contextmenu: false,
        plugins: [
          "advlist autolink lists link image charmap print preview anchor",
          "searchreplace visualblocks code fullscreen",
          "insertdatetime media table contextmenu paste imagetools wordcount",
          "code",
        ],
        toolbar:
          "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code",
      });

      document.querySelector("#btn").onclick = function () {
        //3.获取tinymce编辑器文本
        console.log(tinymce.activeEditor.getContent());
      };
    </script>
  </body>
</html>
